<template>
<div>
  <span class="text-article" v-if="uid === 0 || uid === '0'" >全部</span>
  <span class="text-article" v-else>{{ type }}</span>
  <div>
    <ul style="list-style-type: none;margin: 0;padding: 0;" v-for="(club) in clubs">
      <li style="margin-top: 20px;" @click="toClub(club.id)" >
        <span style="float: left">{{club.name}}</span>
        <span>&nbsp;</span>
      </li>
    </ul>
  </div>
</div>
</template>

<script>
import {clubListApi} from '@/api'
export default {
  name: "ClubC",
  data(){
    return {
      uid: 0,
      type:'',
      clubs:[],
    }
  },

  created() {
      if (this.$route.query.uid!=null){
        this.uid = this.$route.query.uid;
      }
      this.type = this.$route.query.type;
      let club = {type : this.type};
    clubListApi(club).then((result)=>{
        this.clubs = result.data.list;
        console.log(club);
        console.log(this.clubs);
      });

  },

  methods: {
    toClub(id) {
      this.$router.push({
        path: '/clubA/clubB',
        query: {
          id: id,
          uid: this.uid
        }
      });
    }
  }
}
</script>

<style scoped>
.text-article{
  font-size: 1.5em;
  margin-left: -85%;
}
</style>
